<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xppass Administrator's Control Panel</title>
<LINK href="<?php echo $www_site_url?>/public/yav-style.css" type=text/css rel=stylesheet>
<link href="<?php echo $www_site_url?>/public/style/base.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $www_site_url?>/public/js/common.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/ajax.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/calendar.js" type="text/javascript"></script>

<script>

function viewUser(assignment,c_id){
	var url = "<?php echo $www_site_url?>/admin.php/assignment/detail/c_id/"+c_id+'/assignment/'+assignment;
	mini.ajax.get(url, function(r){
		var r = eval('(' + r + ')');
		if(r.s==200){
			$('assignmentid_'+c_id).innerHTML = "<?php echo lang('sex')?>:"+r.d.assignment_sex+ ", <?php echo lang('signup')?>IP:"+ r.d.assignment_reg_ip +", <?php echo lang('lastlogin')?>:"+r.d.assignment_lastlogin_time+
		", <?php echo lang('lastlogin')?>IP:"+r.d.assignment_lastlogin_ip+" <?php echo lang('email')?>:"+r.d.assignment_email;
			$('assignmentid_'+c_id).style.display = 'block';
		}
		if(r.s==400){
			alert(r.m);
		}
	});
}
</script>
</head>
<body><div id="append"></div>
<div id="msg" style="color:red;text-align:center"></div>
<script type="text/javascript">
	function setTab(n){
		document.getElementById("tabs_mainbox").style.display = 'block';
		document.getElementById("close").style.display = 'block';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		var mli=document.getElementById("tabs_main").getElementsByTagName("div");
		for(i=0;i<tli.length-1;i++){
		  tli[i].className=i==n?"hover":"";
		  mli[i].style.display=i==n?"block":"none";
		}
	}
	function hid(){
		document.getElementById("tabs_mainbox").style.display = 'none';
		document.getElementById("close").style.display = 'none';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		for(i=0;i<tli.length;i++){
		  tli[i].className="";
		}
	}
function getStore(c_id){
	if(c_id==''){
		var selobj = $('store_container');
		for(var i in selobj.options){
			selobj.options[i] = null;
		}
		selobj.options[0] = new Option('--', '');
		return ;
	}
	var url = "<?php echo $www_site_url?>/admin.php?action=corporation&view=ajaxstore&c_id="+c_id;

	mini.ajax.get(url, function(r){

		var r = eval('(' + r + ')');

		if(r.s==200){
			var obj = eval('(' + r.d + ')');
			var selobj = $('store_container');
			for(var i in obj){
				//if(i==0) selobj.options[0] = new Option(obj[i].cs_name, obj[i].cs_id) //replace 1st option with a new one
				selobj.options[i]=new Option(obj[i].cs_abbr+' '+obj[i].cs_name, obj[i].cs_id) //add a new option to the end of SELECT
			}

		}
		if(r.s==400){
			$('msg').innerHTML = r.m;
		}
	});

	return false;
}

	</script>

	<div class="container">

			<div id="tabs">
				<div class="tabs_menubox">
					<ul id="tabs_menu">
						<li onclick="setTab(0)"><?php echo lang('search_assignment')?></li>
						<li onclick="hid()" id="close" style="display:none;"><?php echo lang('hide')?>×</li>

					</ul>
				</div>
				<div id="tabs_mainbox" class="tabs_mainbox" style="display:none;">
					<div class="main" id="tabs_main" >
						<div  style="display:none;">
							<form action="<?php echo $www_site_url?>/admin.php" method="GET">
							<input type="hidden" name="action" value="assignment">
							<input type="hidden" name="view" value="assigned">
							<table width="100%">
								<tr>
									<td align="right"><?php echo lang('a_title')?>:</td>
									<td align="left"><input type="text" name="a_title" value="<?php echo $con['a_title']?>" class="textfield" /></td>

									<td><?php echo lang('c_title')?>:</td>
									<td align="left"><select name="c_id" onchange="getStore(this.options[this.selectedIndex].value);">
							<option value="">--</option>
							<?php foreach ($corps as $v){?>
							<option value="<?php echo $v['c_id'];?>"  <?php if($v['c_id']==$con['c_id']) echo 'selected';?> ><?php echo $v['c_initial']." ". $v['c_title'];?></option>
							<?php } ?>
							</select></td>
									<td><?php echo lang('cs_name')?>:</td>
									<td align="left"><select id="store_container" name="cs_id">
							<option value="">--</option>
							</select></td>
									<td rowspan="2"><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
								</tr>
								<tr>
									<td align="right"><?php echo lang('a_sdate')?>:</td>

									<td colspan="3" align="left"><input type="text" name="a_sdate" onclick="showcalendar();" value="<?php echo $con['a_sdate']?>" class="textfield" /> <?php echo lang('to')?> <input type="text" name="a_edate" onclick="showcalendar();" value="<?php echo $con['a_edate']?>" class="textfield" /></td>

								</tr>
							</table>
							</form>
						</div>
				</div>
			</div>

		</div>
		<br>
		<div id="tabsD" style="width:100%">
  <ul>
    <li <?php if($type=='assigned') echo 'class="on"';?>><a href="/admin.php/assignment/assigned" title="<?php echo '已指定';?>"><span><?php echo '已指定';?></span></a></li>
    <li <?php if($type=='quizpass') echo 'class="on"';?>><a href="/admin.php/assignment/quizpass" title="<?php echo '已通过小测试';?>"><span><?php echo '已通过小测试';?></span></a></li>
    <li <?php if($type=='questionpost') echo 'class="on"';?>><a href="/admin.php/assignment/questionpost" title="<?php echo '问卷审核';?>"><span><?php echo '问卷审核';?></span></a></li>
    <li <?php if($type=='auditpass') echo 'class="on"';?>><a href="/admin.php/assignment/auditpass" title="<?php echo '发票审核';?>"><span><?php echo '发票审核';?></span></a></li>

  </ul>
</div>

<br>
<br>
		<h3><?php echo lang('assignment_list')?> <?php echo lang('assignment_total')?>:<?php echo $total?></h3>

		<div class="mainbox">
				<form action="<?php echo $www_site_url?>/admin.php" onsubmit="return confirm('<?php echo lang('domain_delete_comfirm')?>');" method="post">
				<input type="hidden" name="action" value="assignment">
				<input type="hidden" name="op" value="delassignment">
				<table class="datalist fixwidth" onmouseover="addMouseEvent(this);" >

					<tr>
						<th><input type="checkbox" name="chkall" id="chkall" onclick="checkall('delete[]')" class="checkbox" /><label for="chkall" title="<?php echo lang('delete')?>"></label></th>
						<th>ID</th>
						<th><?php echo lang('a_title')?></th>
						<th><?php echo lang('a_sdate')?></th>
						<th><?php echo lang('a_edate')?></th>
						<th><?php echo lang('c_title')?></th>
						<th><?php echo lang('cs_name')?></th>
						<th><?php echo lang('finish')?></th>

						<th><?php echo '状态'?></th>
						<th><?php echo '操作'?></th>

					</tr>
						<?php if(isset($assignments['records']) && is_array($assignments['records'])){
							foreach ($assignments['records'] as $v){?>
						<tr>
							<td class="option"><input type="checkbox" name="delete[]" value="<?php echo $v['a_id']?>" class="checkbox" /></td>
							<td><?php echo $v['a_id']?></td>
							<td><strong><?php echo splitx($v['a_title']);?></strong></td>
							<td><?php echo $v['a_sdate']?></td>
							<td><?php echo $v['a_edate']?></td>
							<td><?php echo splitx($v['c_title'])?></td>

							<td><?php echo splitx($v['cs_name'])?></td>
							<td><?php echo $v['a_finish']?></td>
							<td><?php echo '已指定执行人'?></td>
							<td>
							<a href="/admin.php?action=assignment&view=applicant&a_id=<?php echo $v['a_id'];?>&b_id=<?php echo $v['b_id']?>&a_title=<?php echo urlencode($v['a_title']);?>"><?php echo lang("applicant")?></a>
							<a href="/admin.php?action=assignment&view=assignto&a_id=<?php echo $v['a_id']?>"><?php echo lang('assign_to')?></a>
							<a href="/admin.php?action=express&view=addexpress&a_id=<?php echo $v['a_id']?>&user_id=<?php echo $v['user_id']?>"><?php echo '叫快递'?></a>
							</td>
						</tr>
						<tr>
						<td colspan="10"><div style="display:none" id="assignmentid_<?php echo $v['a_id']?>"></div></td>
						</tr>

						<?php }
						}?>
										<tr class="nobg">
						<td><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
						<td class="tdpage" colspan="10" align="right"><div class="pages"><?php echo $assignments['pagebar']?></div></td>
					</tr>
				</table>

				</form>
					</div>

	</div>

</body>
</html>